package com.ming.controller;

import com.ming.pojo.Book;
import com.ming.service.iBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Books")
public class BookController {
    @Value("${country}")
    private String country;

//  封装全部Value
    @Autowired
    private Environment environment;

    @Autowired
    private iBookService iBookService;

    @GetMapping()
    public String getById(){
        System.out.println("spring");

        System.out.println(environment.getProperty("${tempDir}"));

        System.out.println();
        return "spring";
    }

    @RequestMapping("/list")
    public List<Book> getAll(){
        return iBookService.list();
    }












}
